<!--
 * @Author: YuHao
 * @Date: 2022-04-14 10:33:14
 * @LastEditTime: 2022-04-14 13:21:28
 * @LastEditors: YuHao
 * @Description: 
 * @FilePath: \vben-admin\src\components\Application\src\search\AppSearch.vue
 * Copyright (c) 2022 by 弗斯特机电设备有限公司, All Rights Reserved. 
-->
<script lang="tsx">
  import { defineComponent, ref, unref } from 'vue';
  import { Tooltip } from 'ant-design-vue';
  import { SearchOutlined } from '@ant-design/icons-vue';
  import AppSearchModal from './AppSearchModal.vue';

  export default defineComponent({
    name: 'AppSearch',
    setup() {
      const showModal = ref(false);

      function changeModal(show: boolean) {
        showModal.value = show;
      }

      return () => {
        return (
          <div class="p-1" onClick={changeModal.bind(null, true)}>
            <Tooltip>
              {{
                title: () => '搜索',
                default: () => <SearchOutlined />,
              }}
            </Tooltip>
            <AppSearchModal onClose={changeModal.bind(null, false)} visible={unref(showModal)} />
          </div>
        );
      };
    },
  });
</script>
